<template>
    <vue-office-docx :src="'/api/file/getFile/' + fileId" @rendered="renderedHandler" @error="errorHandler" />
</template>

<script>
//引入VueOfficeDocx组件
import VueOfficeDocx from '@vue-office/docx'
//引入相关样式
import '@vue-office/docx/lib/index.css'

export default {
    name: "preview-doc",
    props: ['fileId'],
    components: {
        VueOfficeDocx
    },
    methods: {
        renderedHandler() {
            console.log("渲染完成")
        },
        errorHandler() {
            console.log("渲染失败")
        }
    },
}
</script>

<style scoped>
::v-deep .docx-wrapper {
    padding: 0 !important;
    background: #fff !important;
}

::v-deep .docx {
    width: 100% !important;
    box-shadow: none !important;
}
</style>